﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using BaMusaSoft.RPS.DataModel;
using BaMusaSoft.RPS.ViewModel;

namespace BaMusaSoft.RPS.View
{
    /// <summary>
    /// Interaction logic for AddClaimDetailsWindow.xaml
    /// </summary>
    public partial class AddClaimDetailsWindow : Window
    {

        public AddClaimDetailsWindow()
        {
            InitializeComponent();
        }
        public AddClaimDetailsWindow(AddContractsClaimedViewModel vm)
            : this()
        {
            this.DataContext = vm;
        }
        private void AddContract(object sender, RoutedEventArgs e)
        {
            Contract selected = contractList.SelectedItem as Contract;
            if (selected != null)
            {
                ((AddContractsClaimedViewModel)this.DataContext).AddToSelectedContract(selected);
            }
        }

        private void OkButtonClick(object sender, RoutedEventArgs e)
        {
            this.DialogResult = true;
        }

        private void RemoveContract(object sender, RoutedEventArgs e)
        {
            Contract selected = contractList.SelectedItem as Contract;
            if (selected != null)
            {
                ((AddContractsClaimedViewModel)this.DataContext).RemoveFromSelectedContracts(selected);
            }
        }
    }
}
